import { Transform } from 'class-transformer';
import { IsArray, IsEnum, IsOptional } from 'class-validator';
import { PagingDto } from 'src/common/dto';
import { WaybillStatusEnum } from 'src/common/enum';

export class ListWaybillDto extends PagingDto {
  @IsOptional()
  @IsEnum(WaybillStatusEnum, { each: true })
  @Transform(({ value = '' }) => {
    return (value?.split(',') || []).map((item) => WaybillStatusEnum[item]);
  })
  waybillStatus?: WaybillStatusEnum[];
}

export class CreateWaybillDto {}
